import { defineStore } from 'pinia'
import type { routerType } from './types/type'
import type { RouteRecordRaw } from 'vue-router'
import store from '../index'

const useStore = defineStore('Router', {
  //小仓库存储数据地方
  state: (): routerType => {
    return {
      // mixin布局左侧菜单
      mixinVerticalRoutes: [],
      // mixin布局下顶部菜单栏的选中项路径
      indexPath: '',
    }
  },
  //异步|逻辑的地方
  actions: {
    setVerticalRoutes(routes: RouteRecordRaw[]) {
      this.mixinVerticalRoutes = routes
    },
    setIndexPath(indexPath: string) {
      this.indexPath = indexPath
    },
  },
  getters: {},
})
export function useRouteStore() {
  return useStore(store)
}
